<template>
<view>
<view class="container" v-if="productData!=null">
<view class="SwiperContainer">
    <!-- <swiper class="SwiperIndex" autoplay="true" interval="5000" duration="500" @change="swiperChange" v-if="productData==null">
      <block v-for="(item, swiper) in productData.images" :key="swiper" style="border-radius: 20rpx">
        <swiper-item :data-imageUrl="productData.images" :data-index="index" @tap="lookBigImage" style="border-radius: 20rpx">
          <image mode="aspectFit" :src="item.imagePath + '?x-oss-process=style/normal'" style="border-radius: 20rpx"></image>
        </swiper-item> 
      </block>
    </swiper> -->
    <banner-component v-if="bannerData&&showBannerState" @bannerCurIndexFun="returnBannerDataFun" :data="bannerData"></banner-component>
    <view class="swiperItemIndex">{{swiperIndex}}/{{totalImg}}</view>
    <block v-if="productData.productInfo.promotionBean">
      <view class="timeCountDownBg" :style="'background:linear-gradient(116deg,' + setting.platformSetting.secondColor + ' 0%,' + color + ' 100%);'" v-if="productData.productInfo.promotionBean.promotionStatus!=2"></view>
      <view class="timeCountDownBg" style="background:linear-gradient(116deg,#eee 0%,#999 100%);" v-else></view>
      <view class="timeCountDown" v-if="productData.productInfo.promotionBean">
        <view class="promotionTitle" v-if="productData.productInfo.promotionBean.promotionStatus==1">
          <image class="timeLeftImg" src="https://image1.sansancloud.com/xianhua/2019_1/28/15/11/13_55.jpg"></image>
          <text class="promotionName">{{productData.productInfo.promotionBean.name}}</text>
        </view>
        <view class="promotionTitle" v-if="productData.productInfo.promotionBean.promotionStatus==2">
          <image class="timeLeftImg" src="https://image1.sansancloud.com/xianhua/2019_1/28/15/11/13_60.jpg"></image>
          <text class="promotionName">{{productData.productInfo.promotionBean.name}}</text>
        </view>
        <view class="promotionTitle" v-if="productData.productInfo.promotionBean.promotionStatus==0">
          <image class="timeLeftImg" src="https://image1.sansancloud.com/xianhua/2019_1/28/15/11/13_55.jpg"></image>
          <text class="promotionName">{{productData.productInfo.promotionBean.name}}</text>
        </view>
        <view class="timeItem">
          <text class="timeText" v-if="productData.productInfo.promotionBean.promotionStatus==1">距结束</text>
          <text class="timeText" v-if="productData.productInfo.promotionBean.promotionStatus==2">已结束</text>
          <text class="timeText" v-if="productData.productInfo.promotionBean.promotionStatus==0">距开始</text>
          <time-component ref='productTimeOne' v-if="productData!=null&&productData.productInfo.promotionBean.promotionStatus==0&&!clearTimeState" :receiveData="productData.productInfo.promotionBean.startDate"></time-component>
          <time-component ref='productTimeTwo' v-if="productData!=null&&productData.productInfo.promotionBean.promotionStatus==1&&!clearTimeState" :receiveData="productData.productInfo.promotionBean.endDate"></time-component>
        </view>
      </view>
    </block>
  </view>  
 
  <view class="ProductDetailInfoContainer" style="position: relative;">
    <view class="pintuan_tip" v-if="promotionState">
      <view class="pintuan_tip_price" :style="'background:' + setting.platformSetting.defaultColor">活动价格</view>
      <view class="triangle_border_left" :style="'border-color: transparent transparent transparent ' + setting.platformSetting.defaultColor + ';'"></view>
    </view>
    <view class="InfoPrice_content">
       <view class="InfoPrice">
          <view class="p1 price_font">
          <!-- ￥{{publicFun.toFix(productData.productInfo.price*productData.productInfo.promotionBean.pintuanStrategy.priceZhekou)}}计算数据 -->
            <text class="pintuan" v-if="promotionState">
              ￥{{productData.productInfo.promotionPrice}}
            </text>
            <text v-else style="font-size:40rpx;">￥{{productData.productInfo.price}}</text>
            <text v-if="productData.productInfo.maxPrice>productData.productInfo.price">-{{productData.productInfo.maxPrice}}</text>
            <text v-if="productData.productInfo.unitShow" style="color:#bbb;font-size:24rpx;margin-left:4rpx;letter-spacing:4rpx;line-height:30rpx;">
              /{{productData.productInfo.unitShow}}
            </text>
          </view>
          <block v-if="productData.productInfo.tagPrice > productData.productInfo.price">
            <text class="tagPrice_font">￥{{productData.productInfo.tagPrice}}</text>
          </block>
          <!-- <block wx:else>
            <text class='tagPrice_font'>￥{{productData.productInfo.price}}</text>
          </block> -->
          <view class="product_stock" v-if="productData.productInfo.stock<=10"><text>仅剩{{productData.productInfo.stock}}件</text></view>
          <view class="product_stock" v-if="productData.productInfo.saleCount>5"><text>已售{{productData.productInfo.saleCount}}件</text></view>
       </view>
       <view class="share_product" @tap="showPoster"><image src="https://image1.sansancloud.com/xianhua/2019_8/8/17/26/49_115.jpg?x-oss-process=style/preview_120"></image></view>
    </view>
    <view class="InfoName">{{productData.productInfo.name}}</view>
    <block v-if="!!productData.productInfo.description">
      <view class="InfoSubName ">·{{productData.productInfo.description}}</view>
    </block>
  </view>
<!-- 促销策略 -->
  <!-- <view class='InfoSale' wx:if='{{saleStrategyState}}' style='background:{{setting.platformSetting.secondColor}}'>
      <view class='InfoSaleDes' style='background:{{setting.platformSetting.defaultColor}}'>
        <view class='InfoSaleText'>促销</view><view class='InfoSaleText'>活动</view>
      </view>
      <text style='color:{{setting.platformSetting.defaultColor}}'>{{productData.productInfo.saleStrategyName}}</text>
  </view> -->
<!--商品特卖  -->
  <view class="special_sale_list" v-if="productData.productInfo.itemSpecialSaleType||saleStrategyState">
    <text class="special_sale_title">促销</text>
    <view class="special_sale_data">
      <view class="special_sale_item" v-if="productData.productInfo.needJifen>0">
          <!--  v-if="productData.productInfo.needJifen>0" -->
        <view class="special_sale_item_type" :style="'border:1rpx solid ' + setting.platformSetting.defaultColor + ';color:' + setting.platformSetting.defaultColor">
          积分
        </view>
        <view class="special_sale_item_value">
          该产品需消耗
          <text :style="'color:' + setting.platformSetting.defaultColor+';font-weight: bold;'">
              {{productData.productInfo.needJifen||1000}}
          </text>
          积分
        </view>
      </view>
      <view class="special_sale_item" v-if="saleStrategyState">
        <view class="special_sale_item_type" :style="'border:1rpx solid ' + setting.platformSetting.defaultColor + ';color:' + setting.platformSetting.defaultColor">
          优惠
        </view>
        <view class="special_sale_item_value">
          {{productData.productInfo.saleStrategyName}}
        </view>
      </view>
      <view class="special_sale_item" v-if="productData.productInfo.itemSpecialSaleType">
        <view class="special_sale_item_type" :style="'border:1rpx solid ' + setting.platformSetting.defaultColor + ';color:' + setting.platformSetting.defaultColor">
          <text v-if="productData.productInfo.itemSpecialSaleType==1">满减</text>
          <text v-if="productData.productInfo.itemSpecialSaleType==2">买赠</text>
          <text v-if="productData.productInfo.itemSpecialSaleType==3">限购</text>
          <text v-if="productData.productInfo.itemSpecialSaleType==4">日限购</text>
          <text v-if="productData.productInfo.itemSpecialSaleType==5">周限购</text>
          <text v-if="productData.productInfo.itemSpecialSaleType==6">月限购</text>
          <text v-if="productData.productInfo.itemSpecialSaleType==7">活动限购</text>
          <text v-if="productData.productInfo.itemSpecialSaleType==8">会员特卖</text>
        </view>
        <view class="special_sale_item_value">
          <view v-if="productData.productInfo.itemSpecialSaleType==1">满
            <text :style="'color:' + setting.platformSetting.defaultColor+';font-weight: bold;'">
                ￥{{productData.productInfo.itemSpecialSaleValue1}}
            </text>减
            <text :style="'color:' + setting.platformSetting.defaultColor+';font-weight: bold;'">
                ￥{{productData.productInfo.itemSpecialSaleValue2}}
            </text>
          </view>
          <view v-if="productData.productInfo.itemSpecialSaleType==2">买
              <text :style="'color:' + setting.platformSetting.defaultColor+';font-weight: bold;'">
                  {{productData.productInfo.itemSpecialSaleValue1}}
              </text>件,赠
              <text :style="'color:' + setting.platformSetting.defaultColor+';font-weight: bold;'">
                  {{productData.productInfo.itemSpecialSaleValue2}}
              </text>件
          </view>
          <view v-if="productData.productInfo.itemSpecialSaleType==3||productData.productInfo.itemSpecialSaleType==4||productData.productInfo.itemSpecialSaleType==5||productData.productInfo.itemSpecialSaleType==6||productData.productInfo.itemSpecialSaleType==7">
              限购<text :style="'color:' + setting.platformSetting.defaultColor+';font-weight: bold;'">
                  {{productData.productInfo.itemSpecialSaleValue1}}
              </text>件
          </view>
          <!-- <view v-if="productData.productInfo.itemSpecialSaleType==4">日限购{{productData.productInfo.itemSpecialSaleValue1}}件</view>
          <view v-if="productData.productInfo.itemSpecialSaleType==5">限购{{productData.productInfo.itemSpecialSaleValue1}}件</view>
          <view v-if="productData.productInfo.itemSpecialSaleType==6">限购{{productData.productInfo.itemSpecialSaleValue1}}件</view>
          <view v-if="productData.productInfo.itemSpecialSaleType==7">限购{{productData.productInfo.itemSpecialSaleValue1}}件</view> -->
          <view v-if="productData.productInfo.itemSpecialSaleType==8">会员特卖</view>
        </view>
      </view>
    </view>
  </view>
<!-- <view class='helpBlank'></view> -->
   <block v-if="clientNo=='tunzai'">
    <view class="tap_title">
        <view class="tap_title_left">
          <view class="tap_title_item"><view class="dot"></view><text class="tap_title_font">正品保证</text></view>
          <view class="tap_title_item"><view class="dot"></view><text class="tap_title_font">永久包邮</text></view>
          <view class="tap_title_item"><view class="dot"></view><text class="tap_title_font">一对一专属售后</text></view>
        </view>
        <view class="tap_title_right">
          <view class="dot_no"></view>
          <view class="dot_no"></view>
          <view class="dot_no"></view>
        </view>
      </view>
    </block>
    <block v-else>
      <block v-if="targs.length!=0">
        <view class="tap_title">
        <view class="tap_title_left">
          <scroll-view style="width:100%;overflow:hidden;white-space:nowrap" scroll-x>
            <view style="display:inline-block" v-for="(item, index) in targs" :key="index">
              <view class="tap_title_item">
                <view class="dot" :style="'background:' + setting.platformSetting.defaultColor+55 + ';border:2rpx solid ' + setting.platformSetting.defaultColor+22 + ';box-shadow:0px 4rpx 14rpx 0px ' + setting.platformSetting.defaultColor+22 + ',0px 4rpx 6rpx 0rpx ' + setting.platformSetting.defaultColor+11 + ';'"></view>
              <text class="tap_title_font">{{item}}</text>
              </view>
            </view>
          </scroll-view>
        </view>
        <!-- <view class='tap_title_right'>
          <view class='dot_no'></view>
          <view class='dot_no'></view>
          <view class='dot_no'></view>
        </view> -->
      </view>
      </block>
    </block>
    <!-- 用户 -->
    <view class="navigation_to_map" v-if="productData.productInfo.belongPlatformUserId">
      <view class="navigation_addr">
        <image class="navigation_addr_img" src="https://image1.sansancloud.com/xianhua/2020_6/3/11/32/26_164.jpg?x-oss-process=style/preview_120"></image>
        <text class="navigation_addr_value">{{productData.productInfo.belongPlatformUserName}}</text>
      </view>
      <view class="navigation_button" :style="'background:' + setting.platformSetting.defaultColor" :data-link="'chat_room.html?puid=' + productData.productInfo.belongPlatformUserId + '&puname=' + productData.productInfo.belongPlatformUserName" @click.stop="tolinkUrl">
        <image class="navigation_button_img" src="https://image1.sansancloud.com/xianhua/2020_6/3/11/27/15_98.jpg?x-oss-process=style/preview_120"></image>
        <text class="navigation_button_value">聊天</text>
      </view>
    </view>
    <!-- 导航 -->
    <view class="navigation_to_map" v-if="positionState">
      <view class="navigation_addr">
        <image class="navigation_addr_img" src="https://image1.sansancloud.com/xianhua/2018_9/13/17/57/21_219.jpg?x-oss-process=style/preview_120"></image>
        <text class="navigation_addr_value">{{productData.productInfo.location}}</text>
      </view>
      <view class="navigation_button" :style="'background:' + setting.platformSetting.defaultColor" @tap="clickCatch">
        <image class="navigation_button_img" src="https://image1.sansancloud.com/xianhua/2018_9/13/21/22/3_772.jpg?x-oss-process=style/preview_120"></image>
        <text class="navigation_button_value">位置</text>
      </view>
    </view>
<!--拼团  -->
    <view class="pintuan_block" v-if="pintuanState">
       <view class="pintuan_title_padding">
          <view class="pintuan_title">
            <view class="pintuan_title_left">
               <text :style="'color:' + setting.platformSetting.defaultColor">{{pintuanListData.length}}</text>
               <text>人在拼单，可直接参与</text></view>
            <view class="pintuan_title_right" @click.stop="showPintuan" v-if="pintuanListData.length!=0"><text>查看更多</text><text class="check_more">></text></view>
          </view>
       </view>
       <!-- <scroll-view scroll-y="true" style="height: 200rpx;"  class='pintuan_list'> -->
       <!-- <view class='pintuan_list'> -->
       <view class="unpintuan_list" v-if="pintuanListData.length==0">
         <text :style="'color:' + setting.platformSetting.defaultColor">暂无人员拼单</text>
       </view>
       <swiper autoplay="true" interval="5000" duration="500" vertical="true" :display-multiple-items="visiblePintuanNum" class="pintuan_list" v-else>
          <!-- <view class='pintuan_item'> -->
          <swiper-item class="pintuan_item " v-for="(item, index) in pintuanListData" :key="index">
              <view class="pintuan_item_left">
                <image class="user_head_img" :src="item.createPlatformUserIcon"></image>
                <text class="user_name">{{item.createPlatformUserName}}</text>
              </view>
              <view class="pintuan_item_right">
                <view class="pintuan_item_data">
                  <view class="pintuan_item_num">还差<text :style="'color:' + setting.platformSetting.defaultColor">{{item.userCountLimit-item.attendedUserCount}}人</text>拼成</view>
                  <view class="pintuan_item_time">剩余:
				    <time-component ref='productTimeThree' :receiveData="item.endTime" v-if="!clearTimeState"></time-component>
				  </view>
                </view>
                <view class="pintuan_button" :style="'background:' + setting.platformSetting.defaultColor" :data-pintuanid="item.id" data-way="addPintuan" @tap="readyPay2">
                  <text class="pintuan_button_text">去拼团</text>
                </view>
              </view>
          </swiper-item>
          <!-- </view> -->
        </swiper>
       <!-- </view> -->
       <!-- </scroll-view> -->
    </view>

    <view v-if="measuresState">
      <block v-if="haveMeasuresState">
        <view class="specifications" data-way="select" @tap="readyPay2">
          <text class="have_select">已选择</text>
          <view class="value">
            <text class="value_item" v-for="(item, index) in selectTypeData" :key="index">{{item.value}}</text>
          </view>
        </view>
      </block>
      <block v-else>
        <view class="specifications" data-way="select" @tap="readyPay2">
          <text class="no_select" :style="'color:' + setting.platformSetting.defaultColor">请选择规格</text>
        </view>
      </block>
    </view>

    <view class="product_introduce">
      <view class="product_introduce_short" v-if="attrsState">
        <text class="product_introduce_title">商品介绍</text>
        <view class="product_introduce_item" v-for="(item, index) in productData.attrs" :key="index">
            <text class="product_introduce_item_name">{{item.attributeName}}</text>
            <text class="product_introduce_item_vaule">{{item.attributeValue}}</text>
        </view>
      </view>
    </view>
    <!-- 核销列表 -->
    <view class="verification_block" v-if="scanExhauseList.length!=0">
      <view class="verification_title">
        <view class="verification_title_item" style="width:30%">
          <text>项目名称</text>
        </view>
        <view class="verification_title_item" style="width:50%">
          <text>项目内容</text>
        </view>
        <view class="verification_title_item" style="width:20%">
          <text>项目次数</text>
        </view>
      </view>
      <view class="verification_list">
        <view class="verification_item" v-for="(item, index) in scanExhauseList" :key="index">
          <text class="verification_item_data" style="width:30%">{{item.name}}</text>
          <text class="verification_item_data" style="width:50%">{{item.remark}}</text>
          <text class="verification_item_data" style="width:20%">{{item.count}}次</text>
        </view>
      </view>
    </view>
    <!-- 首页组件-私有产品详情装饰-->
    <view style="margin-top:20rpx;">
     <custom-page-index-component :receiveData="sendProductData" v-if="sendProductData"></custom-page-index-component>
    </view>
    <!-- 富文本 -->
    <view class="product_main_info" v-if="productData.description.description!=''&&productData.description.description!='<p><br></p>'">
      <text>图文详情</text>
    </view>
    <view class="tab_detail_container" v-if="productData.description.description!=''&&productData.description.description!='<p><br></p>'">
       <view class="wxParseHtmlContainer"> 
	      <!-- <component is="init" :wxParseData="article.nodes"></component> -->
		  <rich-text-component :receiveData="articleJsonData" v-if="articleJsonData"></rich-text-component>
	   </view>
    </view>

    <!-- <view class='price_explain'>
      <text class='price_explain_title'>价格说明</text>
      <view class='price_explain_content'>店铺中展示的中间未划横线价格为该店铺的销售价，该价格是交易成交价，是您最终决定是否购买商品的依据。店铺展示的中间划横线价格(显示如¥1000)为参考价，采集自品牌专柜标价、商品吊牌价或由品牌供应商提供的正品零售价由于地区、时间的差异性和市场行情波动，品牌专柜标价、商品吊牌价可能会与您购物时展示的不一致。该价格仅供您参考。</view>
    </view> -->

 <!-- 首页组件-公共产品详情装饰-->
 <custom-page-index-component :receiveData="sendIndexData" v-if="sendIndexData"></custom-page-index-component>
 <!-- <component-customPage :receiveData="sendIndexData" v-if="sendIndexData"></component-customPage> -->
</view>


<!-- 底部按钮们 -->
<view class="bottomHeight"></view>
<view class="product_detail_bottom_container">
 <view class='left_bottom' :data-itemId="productData.productInfo.productId" @tap="toIndex">
   <image class="left_bottom_icon" mode="aspectFit" src="https://image1.sansancloud.com/xianhua/2019_11/20/14/38/47_682.jpg?x-oss-process=style/preview_120"></image>
   <text style="font-size:22rpx;color:#aaa">首页</text>
  </view> 
  <view class="left_bottom" @tap="toCart" v-if="!productData.productInfo.preOrderCustomFormId">
    <view class="cartNumber" :style="'background:' + color">{{countGood}}</view>
    <image class="left_bottom_icon" mode="widthFix" src="https://image1.sansancloud.com/xianhua/2019_11/20/14/39/19_841.jpg?x-oss-process=style/preview_120"></image>
    <text style="font-size:22rpx;color:#aaa">购物车</text>
  </view>
  <block v-if="!pintuanState">
    <view class="right_bottom addto font_08" data-way="cart" @tap="readyPay2" :style="' border: 2rpx solid ' + color + ';color:' + color" v-if="!productData.productInfo.preOrderCustomFormId">加入购物车</view>
    <!-- <view wx:else class='right_bottom'></view> -->
    <view :class="(productData.productInfo.preOrderCustomFormId?'w_630':'') + ' right_bottom bynow font_08'" data-way="buy" @tap="readyPay2" :style="'background-image:linear-gradient(to right,' + secondColor + ',' + color + ');box-shadow:0px 0px 6px 0px ' + color + ';'">
      <!-- <text wx:if="{{productData.productInfo.preOrderCustomFormId}}">立即下单</text> -->
      <text>立即购买</text>
    </view>
  </block>
  <block v-else>
    <view class="right_bottom addto font_08" data-way="pintuanOne" @tap="readyPay2" :style="' border: 2rpx solid ' + color + ';color: ' + color">单独购买</view>
  <view class="right_bottom bynow font_08" data-way="pintuanMore" @tap="readyPay2" :style="'background-image:linear-gradient(to right,' + secondColor + ',' + color + ');box-shadow:0px 0px 6px 0px ' + color + ';'">发起拼单</view>
  </block>
</view>

<posters-component :proId="proId" :shopId="shopId" :ewmImgUrl="qrCodeUrl" v-if="posterState" @closePoaster="getChilrenPoster"></posters-component> 
<pintuan-component :pintuanParam="pintuanParam" v-if="pintuanPopupState" @closePintuan="getChilrenPintuan" @goPintuan="readyPay2"></pintuan-component>
<measure-card-component v-if='showCount' :showCount="showCount" :pintuanParams="pintuanParams" :productData='productData' :byNowParams="byNowParams" :bindway="bindway" @closeCard="getCloseCardFun"></measure-card-component>

<!-- 填写表单弹窗动画 -->
<!-- <view class='zhezhao' v-if="showPerFormState" @tap='closeZhezhao'></view>
<view class='popupFormDetail' :animation="animationData">
 <view class='form_title' >
   <text ></text>
   <text>请填写以下信息</text>
   <image class='close_popup_icon' src='https://image1.sansancloud.com/xianhua/2019_7/31/15/25/40_755.jpg?x-oss-process=style/preview_120' @click='closeZhezhao'></image>
 </view>
 <scroll-view scroll-y  style='max-height:700rpx'>
   <view v-if="sendOptionData&&showPerFormState">
      <form-detail-component id="submitOrderForm" :receiveData="sendOptionData" :showTitle="false" :showBtn="false" @sendDataFun="getDataFun"></form-detail-component>
   </view>
   </scroll-view>
</view>
<view v-if="sendOptionData&&showPerFormState" class='submitBtn' :style='{background:color}' @click='submitData'>
 <text>提交</text>
</view> -->
</view>
</template>

<script>

import publicFun from '../../wxcomponents/public/publicFun.wxs'
var WxParse = require('../../wxcomponents/wxParse/wxParse.js')

export default {
  data() {
    return {
      setting: null,
      // setting 
      productData: null,
      // 商品数据 
      cart: null,
      countGood: 0,
      sysWidth: 320,
      //图片大小
      showCount: false,
      saleStrategyState: false,
      measuresState: false,
      positionState: false,
      attrsState: false,
      targs: [],
      posterState: false,
      pintuanPopupState: false,
      proId: '',
      shopId: '',
      bindway: 'cart',
      //点击的是加入购物车或者立即购买
      showState: 0,
      commitList: [],
      measurementJson: null,
      qrCodeUrl: "",
      haveMeasuresState: false,
      selectTypeData: null,
      swiperIndex: 1,
      totalImg: 0,
      pintuanId: 0,
      pintuanState: false,
      promotionState: false,
      pintuanListData: [],
      color: '',
      secondColor: "",
      clientNo: '',
      minCount: '1',
      sendIndexData: {},
      buyType: 'normal',
      scanExhauseList: [],
      byNowParams: {
        productId: '',
        itemCount: 1,
        shopId: '',
        cartesianId: '0',
        fromSource: 'mini',
        orderType: ''
      },
      pintuanParams: {
        pintuanCreateType: 0,
        pintuanRecordId: 0
      },
      dataFOr_getData: {
        id: '',
        addShopId: ''
      },
      pintuanParam: "",
      visiblePintuanNum: 0,
      sendProductData: "",
      showGuigeType: false,
      article: "",
	  articleJsonData:'',
	  MeasureParams:[],
      showBannerState:true,
      clearTimeState:false,
      bannerData:null,
      // showPerFormState:false,
      // animationData:null,
      // sendOptionData:null,
    };
  },
  props: {},
  onError: function (options) {
    console.log("on error!!!");
  },
  onLoad: function (options) {
    this.publicFun = publicFun;
    console.log('--------product----------', options);
    let that = this;
    that.setData({
      showBannerState:true,
      sysWidth: getApp().globalData.sysWidth,
      proId: options.id || options.productId,
      shopId: options.addShopId||236,
      clientNo: getApp().globalData.clientNo,
      color: getApp().globalData.setting.platformSetting.defaultColor,
      secondColor: getApp().globalData.setting.platformSetting.secondColor
    });
    let sendIndexData = JSON.stringify({
      title: 'noTitle',
      url: "productdetail",
      params: {
        pageObjectId: options.id || options.productId
      }
    });
    that.setData({
      sendIndexData: sendIndexData
    });
    let sendProductData = JSON.stringify({
      title: 'noTitle',
      url: "product_detail_" + (options.id || options.productId)
    });
    that.setData({
      sendProductData: sendProductData
    });
    console.log("商品id和店铺id", options);
    that.dataFOr_getData.id = options.id || options.productId;
    that.dataFOr_getData.addShopId = options.addShopId;
    that.setData({
      dataFOr_getData: that.dataFOr_getData
    });
    that.optionsData = options;
    that.getData(that.optionsData);
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    this.setData({
      setting: getApp().globalData.setting
    });
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
      let that=this;
      that.setData({
        showBannerState:true,
      })
      if(that.clearTimeState){
        that.setData({clearTimeState:false})
      }
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
      this.setData({
        showBannerState:false,
      })
      this.setData({clearTimeState:true})
      console.log("==this.$refs===",this.$refs)
      this.$refs.productTimeOne?this.$refs.productTimeOne.setShowTimeStateFun(true):'';
      this.$refs.productTimeTwo?this.$refs.productTimeTwo.setShowTimeStateFun(true):'';
      this.$refs.productTimeThree?this.$refs.productTimeThree.setShowTimeStateFun(true):'';
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
      this.setData({
        showBannerState:false,
      })
      console.log("==this.$refs===",this.$refs)
      this.setData({clearTimeState:true})
      this.$refs.productTimeOne?this.$refs.productTimeOne.setShowTimeStateFun(true):'';
      this.$refs.productTimeTwo?this.$refs.productTimeTwo.setShowTimeStateFun(true):'';
      this.$refs.productTimeThree?this.$refs.productTimeThree.setShowTimeStateFun(true):'';
    },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {},

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {},

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function (res) {
    console.log(res);
    let that = this;
    let params = that.dataFOr_getData;
    let productItem = that.productData.productInfo;

    if (!productItem.brandName || productItem.brandName == "") {
      productItem.brandName = "";
    }

    ;
    let shareName = '活动价：￥' + productItem.price + '(原价：￥' + productItem.tagPrice + ')' + productItem.brandName + productItem.name;
    console.log('params:', params, that.productData);
    return getApp().globalData.shareForFx2('productDetail', shareName, params);
  },
  methods: {
    // submitData:function(){
    //     let that=this;
    //     that.selectComponent("#submitOrderForm").formSubmit();
    // },
    // getDataFun: function (e) {
    //   let that = this;
    //   console.log("===getDataFun===", e, e.detail.formId)
    //   that.submitInvoiceFun(e.detail.formId)
    // },
    // closeFormZhezhao:function(){
    //   console.log("======closeZhezhao=========")
    //   let that=this;
    //   that.setData({ showPerFormState: false })
    //   let animation = wx.createAnimation({
    //     duration: 400,
    //     timingFunction: 'ease',
    //   })
    //   animation.bottom('-200rpx').step()
    //   let setData = animation.export()
    //   that.setData({
    //     animationData: setData,
    //   })
    // },
    tolinkUrl: function (data) {
      let that = this;
      console.log("data", data);
      let linkUrl = data.currentTarget ? data.currentTarget.dataset.link : data;
      console.log("==linkUrl===", linkUrl);
      getApp().globalData.linkEvent(linkUrl);
    },
    getCloseCardFun:function(data){
        let that=this;
        console.log("===getCloseCardFun==",data)
        that.setData({showCount:false})
    },
    /*轮播图下标*/
    swiperChange: function (e) {
      this.setData({
        swiperIndex: e.detail.current + 1
      });
    },
    returnBannerDataFun:function(e){
      let that=this;
      this.setData({
        swiperIndex: e.detail.index + 1
      });
    },
    getChilrenPintuan(e) {
      let that = this;
      that.setData({
        pintuanPopupState: false
      });
    },

    showPintuan: function () {
      console.log('=======');
      let that = this;
      that.setData({
        pintuanPopupState: true
      });
    },
    showPoster: function () {
      console.log('===showPoster====', getApp().globalData.clientNo);
      let that = this;
      this.getQrCode();
      that.setData({
        posterState: true
      });
    },
    toIndex: function () {
      getApp().globalData.toIndex();
    },
    posterStateFun: function (state) {
      console.log('====state====', state);
      this.setData({
        posterState: true
      });
    },
    getChilrenPoster: function (e) {
      console.log('=======', e);
      this.setData({
        posterState: false
      });
    },
    lookBigImage: function (e) {
      console.log("111111111", e.currentTarget.dataset);
      let imgSrc = e.currentTarget.dataset.imageurl;
      let imgArray = [];
      let index = e.currentTarget.dataset.index;
      let PostImageSrc = [];
      console.log(imgSrc);

      for (let i = 0; i < imgSrc.length; i++) {
        imgArray.push(imgSrc[i].imagePath);
        PostImageSrc.push(imgSrc[i].imagePath.replace(/http/, "https"));
      } 
      console.log(PostImageSrc);
      if (!imgSrc) {
        return;
      }
      wx.previewImage({
        current: imgArray[index],
        // 当前显示图片的http链接
        urls: imgArray // 需要预览的图片http链接列表

      });
    },
    showCouponState: function (e) {
      var index = e.currentTarget.dataset.id;
      this.setData({
        showState: index
      });
    },
    aaaaa: function (e) {
      console.log("hello");
      getApp().globalData.linkEvent("product_detail_9218.html");
    },

    /* 删除收藏 */
    removeFavourite: function (e) {
      var that = this;
      getApp().globalData.showToastLoading('loading', true);
      var postData = {
        itemId: '',
        favoriteType: '1'
      };
      let productData = this.productData;
      postData.itemId = e.currentTarget.dataset.itemid;
      var customIndex = getApp().globalData.AddClientUrl("/remove_favorite.html", postData, 'post');
      wx.request({
        url: customIndex.url,
        data: customIndex.params,
        header: getApp().globalData.headerPost,
        method: 'POST',
        success: function (res) {
          console.log(res.data);

          if (res.data.errcode == '0') {
            productData.productInfo.favorite = 0;
            that.setData({
              productData: productData
            });
            console.log('000---' + that.productData.productInfo.favorite);
          }
        },
        fail: function (res) {
          getApp().globalData.loadFail();
        },
        complete: function (res) {
          wx.hideLoading();
        }
      });
    },

    /* 加入收藏 */
    addToFavourite: function (e) {
      var that = this;
      var postData = {
        itemId: '',
        favoriteType: '1'
      }; 
      getApp().globalData.showToastLoading('loading', true);
      let productData = this.productData;
      postData.itemId = e.currentTarget.dataset.itemid;
      console.log(postData);
      var customIndex = getApp().globalData.AddClientUrl("/add_to_favorite.html", postData, 'post');
      wx.request({
        url: customIndex.url,
        data: customIndex.params,
        header: getApp().globalData.headerPost,
        method: 'POST',
        success: function (res) {
          console.log(res.data);

          if (res.data.errcode == '0') {
            productData.productInfo.favorite = 1;
            that.setData({
              productData: productData
            });
            console.log('111---' + that.productData.productInfo.favorite);
          }
        },
        fail: function (res) {
          getApp().globalData.loadFail();
        },
        complete: function (res) {
          wx.hideLoading();
        }
      });
    },

    /* 查看图文详情   -- 已禁用 */
    lookDerection: function (e) {
      var images = e.currentTarget.dataset.derection;
      var sentMessage = "";

      for (let i = 0; i < images.length; i++) {
        sentMessage += "&" + i + "=" + images[i];
      }

      sentMessage = sentMessage.substring(1);
      console.log(sentMessage);
      wx.navigateTo({
        url: '/pages/productDetail_derection/index?' + sentMessage
      });
    },
    ChangeParam: function (params) {
      var returnParam = "";

      for (let i in params) {
        returnParam += "&" + i + "=" + params[i];
      }

      return returnParam;
    },

    /* dadianhua */
    callShop: function () {
      if (this.setting) {
        wx.makePhoneCall({
          phoneNumber: this.setting.platformSetting.defaultShopBean.telno //仅为示例，并非真实的电话号码

        });
      }
    },
    toCart: function () {
      console.warn("cart"); // let url ="shopping_car_list_new.html"
      getApp().globalData.linkEvent("shopping_car_list_new.html");
    },

    /* 找到购物车里面的内容 */
    findInCart: function (data) {
      var cart = null;
      this.postParams(data);
    },
    // readyPay: function (e) {
    //   this.setData({
    //     showCount: true
    //   });
    //   let info = e.currentTarget.dataset.item;
    //   this.byNowParams.productId = info.productId;
    //   this.byNowParams.shopId = info.belongShopId;
    //   this.byNowParams.orderType = 0;
    //   this.setData({
    //     byNowParams: this.byNowParams
    //   });
    // },
    readyPay2: function (e) {
      console.log('====e=====', e);
      // if (!getApp().globalData.checkIfLogin()) {
      //   return;
      // }
      if(!getApp().globalData.loginUser){
          let url="productDetail.html?id="+this.proId;
          let backUrl=encodeURIComponent(url)
          getApp().globalData.checkIfLogin(backUrl);
          return
      }
      if (this.productData.productInfo.promotionBean && this.productData.productInfo.promotionBean.promotionStatus == 2) {
        console.log('活动已结束！');
        wx.showToast({
          title: '活动已结束！',
          image: '/wxcomponents/images/icons/tip.png',
          duration: 1000
        });
        return;
      }

      let productData = this.productData;
      let way;
      let pintuanRecordId;
      console.log(productData);

      if (e.currentTarget.dataset.way) {
        way = e.currentTarget.dataset.way;
        pintuanRecordId = e.currentTarget.dataset.pintuanid;
      } else {
        way = e.detail.data.way;
        pintuanRecordId = e.detail.data.pintuanid;
      }

      this.setData({
        bindway: way
      });
      console.log('====q=====', this.bindway);
      let info = productData.productInfo;
      this.byNowParams.productId = info.productId;
      this.byNowParams.shopId = info.belongShopId;
      this.setData({
        byNowParams: this.byNowParams
      });

      if (way == 'cart') {
        if (productData.measures.length == 0) {
          this.addtocart();
        } else {
          this.setData({
            showCount: true
          });
          this.byNowParams.orderType = 0;
          this.setData({
            byNowParams: this.byNowParams
          });
          // this.chooseMeasureItem();
        }
      } else if (way == 'pintuanOne') {
        //单独购买
        this.setData({
          showCount: true
        });
        this.byNowParams.orderType = 0;
        this.pintuanParams.pintuanCreateType = 0;
        this.pintuanParams.pintuanRecordId = 0;
        this.setData({
          byNowParams: this.byNowParams,
          pintuanParams: this.pintuanParams
        });
        // this.chooseMeasureItem();
      } else if (way == 'pintuanMore') {
        //参加拼团
        this.setData({
          showCount: true
        });
        this.byNowParams.orderType = 0;
        this.pintuanParams.pintuanCreateType = 1;
        this.pintuanParams.pintuanRecordId = 0;
        this.setData({
          byNowParams: this.byNowParams,
          pintuanParams: this.pintuanParams
        });
        // this.chooseMeasureItem();
      } else if (way == 'addPintuan') {
        //发起拼单
        this.setData({
          showCount: true
        });
        this.setData({
          pintuanPopupState: false
        });
        this.byNowParams.orderType = 0;
        this.pintuanParams.pintuanCreateType = 2;
        this.pintuanParams.pintuanRecordId = pintuanRecordId;
        this.setData({
          byNowParams: this.byNowParams,
          pintuanParams: this.pintuanParams
        });
        // this.chooseMeasureItem();
      } else if (way == 'select') {
        this.setData({
          showCount: true
        });
        this.byNowParams.orderType = 0;
        this.setData({
          byNowParams: this.byNowParams
        });
        // this.chooseMeasureItem();
      } else {
        this.setData({
          showCount: true
        });
        this.byNowParams.orderType = 0;
        this.setData({
          byNowParams: this.byNowParams
        });
        // this.chooseMeasureItem();
      }
    },
    closeZhezhao: function () {
      this.setData({
        showCount: false
      });
    },

    /* 创建订单 */
    createOrder22: function (o) {
      console.log('========createOrder22======', o);
      let that = this;
      let productInfo = that.productData.productInfo;
      let params = Object.assign({}, params, that.byNowParams, that.pintuanParams);
      console.log("=======", that.byNowParams, that.pintuanParams);
      getApp().globalData.showToastLoading('loading', true);
      getApp().globalData.createOrder(that.byNowParams, that.pintuanParams);
    },

    /* 加入購物車 */
    addtocart: function () {
      if (!getApp().globalData.checkIfLogin()) {
        return;
      }
      var params = {
        cartesianId: '',
        productId: '',
        shopId: '',
        count: '',
        type: ''
      };

      if (this.productData.measures.length == 0) {
        params.cartesianId = '0';
      } else {
        params.cartesianId = this.measurementJson.id;
      }

      params.productId = this.productData.productInfo.productId;
      params.shopId = this.productData.productInfo.belongShopBean.id;
      params.count = this.byNowParams.itemCount;
      params.type = 'add';
      console.log('===postParams=====', params);
      this.postParams(params);
    },
    postParams: function (data) {
      var that = this;
      var customIndex = getApp().globalData.AddClientUrl("/change_shopping_car_item.html", data, 'post');
      wx.request({
        url: customIndex.url,
        data: customIndex.params,
        header: getApp().globalData.headerPost,
        method: 'POST',
        success: function (res) {
          console.log('---------------change_shopping_car_item-----------------');
          console.log(res.data);
          wx.hideLoading();

          if (that.bindway == 'cart') {
            that.setData({
              showCount: false
            });
          }

          if (data.productId == 0) {
            console.log('购物车里面的商品数量');
            that.setData({
              countGood: res.data.totalCarItemCount
            });
          } else {
            if (res.data.productId && res.data.productId != 0) {
              if (data.count == 0) {
                console.log('通过加入购物车来确定购物车里面的商品数量');
              } else {
                wx.showToast({
                  title: '加入购物车成功'
                });
              }

              if (!!res.data.totalCarItemCount || res.data.totalCarItemCount == 0) {
                that.setData({
                  countGood: res.data.totalCarItemCount
                });
              }
            } else {
              wx.showToast({
                title: res.data.errMsg,
                image: '/wxcomponents/images/icons/tip.png',
                duration: 2000
              });
            }
          }
        },
        fail: function (res) {
          wx.hideLoading();
          getApp().globalData.loadFail();
        }
      });
    },

    /**
     * 生命周期函数--监听页面加载
     */
    getPintuanData: function (productId, promotionId) {
      let that = this;
      let data = {
        status: 1,
        productId: productId,
        promotionId: promotionId
      };
      that.setData({
        pintuanParam: data
      });
      var pintuanUrl = getApp().globalData.AddClientUrl("/wx_find_pintuan_records.html", data, 'post');
      wx.request({
        url: pintuanUrl.url,
        data: pintuanUrl.params,
        header: getApp().globalData.headerPost,
        method: 'POST',
        success: function (res) {
          console.log('--------add----------');
          console.log(res.data);
          that.setData({
            pintuanListData: res.data.relateObj.result
          });

          if (that.pintuanListData.length == 1) {
            that.setData({
              visiblePintuanNum: 1
            });
          } else {
            that.setData({
              visiblePintuanNum: 2
            });
          }
        },
        fail: function (res) {
          getApp().globalData.loadFail();
        },
        complete: function () {
          wx.hideLoading();
        }
      });
    },
    getData: function (options, type) {
      let param = {};
      let that = this;

      if (!options) {
        param = that.dataFOr_getData;
      } else {
        param = options;
      }
      getApp().globalData.showToastLoading('loading', true);
      console.log('==param===', param); // let postParam = {}

      param.productId = param.id || param.productId;
      param.addShopId = param.addShopId||236;
      let customIndex = getApp().globalData.AddClientUrl("/product_detail.html", param);
      wx.request({
        url: customIndex.url,
        header: getApp().globalData.header,
        success: function (res) {
          console.log(res);

          if (res.data.productInfo.errcode == -1) {
            wx.showToast({
              title: res.data.productInfo.relateObj,
              image: '/wxcomponents/images/icons/tip.png',
              duration: 1000
            });
            return;
          }

          that.setData({
            pintuanState: false
          });
          console.log('--------------getData-------------');
          let scanExhauseList = '';

          if (res.data.productInfo.scanExhauseList) {
            scanExhauseList = JSON.parse(res.data.productInfo.scanExhauseList);
            that.setData({
              scanExhauseList: scanExhauseList.items
            });
          }

          res.data.productInfo.promotion = Number(res.data.productInfo.promotion);

          if (res.data.productInfo && res.data.productInfo.promotionBean) {
            that.setData({
              promotionState: true
            });

            if (res.data.productInfo.promotionBean.promotionStatus == 2) {
              that.setData({
                color: '#888',
                secondColor: '#fff'
              });
            }

            if (res.data.productInfo.promotionBean.pintuanStrategy && res.data.productInfo.promotionBean.pintuanStrategy.id) {
              that.setData({
                pintuanState: true
              });
              that.getPintuanData(res.data.productInfo.productId, res.data.productInfo.promotionBean.id); //获取拼团人员的数据
            }
          }
          let bannerData={jsonData:{autoplay:'autoplay',styleType:'product',width:620,height:620,images:res.data.images}}
          that.setData({
            productData: res.data,
            bannerData:bannerData
          });

          if (res.data.images) {
            that.setData({
              totalImg: res.data.images.length
            });
          }

          if (res.data.productInfo && res.data.productInfo.tags) {
            let tagsStr = res.data.productInfo.tags;
            let tagsStr2 = tagsStr.replace(/\[/g, '');
            let tagArr = tagsStr2.split(']');
            tagArr.length--;
            that.setData({
              targs: tagArr
            });
            console.log('targs', that.targs);
          }

          if (res.data.description && res.data.description.description) {
			let articleJsonData=res.data.description.description;
			that.setData({
			  articleJsonData: {jsonData:{content:articleJsonData}}
			});
            console.log('====articleJsonData====', that.articleJsonData);
          }

          if (res.data.productInfo.saleStrategy && res.data.productInfo.saleStrategy != 0) {
            that.setData({
              saleStrategyState: true
            });
            console.log('====saleStrategyState====', that.saleStrategyState);
          }

          if (res.data.measuresState && res.data.measuresState.length != 0) {
            that.setData({
              measuresState: true
            });
            console.log('====measuresState====', that.measuresState);
          }

          if (res.data.productInfo.latitude && res.data.productInfo.latitude != 0) {
            that.setData({
              positionState: true
            });
            console.log('====positionState====', that.positionState);
          }

          if (res.data.attrs && res.data.attrs.length != 0) {
            that.setData({
              attrsState: true
            });
            console.log('====attrsState====', that.attrsState);
          }

          if (!!res.data.productInfo) {
            let info = res.data.productInfo;
            let postPatam = {}; //var paramStr = 'page=1&productId=' + info.productId+'&shopId=' + info.belongShopId

            postPatam.page = 1;
            postPatam.productId = info.productId;
            postPatam.shopId = info.belongShopId; // that.getCommitData(postPatam)

            that.getCart();
          }

          console.log('productData', that.productData);
        },
        fail: function (res) {
          console.log("====fail=====");
          getApp().globalData.loadFail();

          if (!type) {
            console.log("======加载失败一次======");
            that.optionsData.someOneParam = 1;
            that.getData(that.optionsData, 'lastOne');
          }
        },
        complete: function (res) {
          wx.hideLoading();
        }
      });
    },
    getCart: function () {
      var params = {};
      params.productId = 0;
      params.count = 0;
      params.type = 'add';
      this.postParams(params);
    },
    //提交规格产品
    // submitMeasure: function (id) {
    //   var that = this;
    //   let focusProduct = this.MeasureItem;
    //   let measurementJson = this.measurementJson;
    //   let data = {};
    //   data.cartesianId = measurementJson.id;
    //   data.productId = focusProduct.id;
    //   data.shopId = focusProduct.belongShopId;
    //   data.count = 1;
    //   data.type = 'add';
    //   var customIndex = getApp().globalData.AddClientUrl("/change_shopping_car_item.html", data, 'post');
    //   wx.request({
    //     url: customIndex.url,
    //     data: customIndex.params,
    //     header: getApp().globalData.headerPost,
    //     method: 'POST',
    //     success: function (res) {
    //       console.log('--------add----------');
    //       console.log(res.data);
    //       that.setData({
    //         showGuigeType: false
    //       });
    //     },
    //     fail: function (res) {
    //       getApp().globalData.loadFail();
    //     },
    //     complete: function () {
    //       wx.hideLoading();
    //     }
    //   });
    // },
    //获取规格价格参数
    // get_measure_cartesionFun: function () {
    //   console.log('get_measure_cartesion');
    //   this.setData({
    //     measurementJson: {
    //       waitDataState: false
    //     }
    //   });
    //   let productId = this.productData.productInfo.productId;
    //   let postStr = '';

    //   if (this.MeasureParams.length == 0) {
    //     this.byNowParams.cartesianId = '0';
    //     this.setData({
    //       measurementJson: {
    //         waitDataState: true
    //       }
    //     }); //没有规格时 不需要等待请求

    //     return;
    //   }

    //   for (let i = 0; i < this.MeasureParams.length; i++) {
    //     postStr += this.MeasureParams[i].value + ',';
    //   }

    //   let param = {};
    //   param.productId = productId;
    //   param.measureIds = postStr;
    //   console.log(postStr);
    //   let customIndex = getApp().globalData.AddClientUrl("/get_measure_cartesion.html", param);
    //   var that = this;
    //   wx.request({
    //     url: customIndex.url,
    //     header: getApp().globalData.header,
    //     success: function (res) {
    //       console.log(res.data);
    //       that.byNowParams.cartesianId = res.data.id;
    //       that.setData({
    //         measurementJson: res.data
    //       });
    //       that.measurementJson.waitDataState = true;
    //       that.setData({
    //         measurementJson: that.measurementJson
    //       });
    //       that.byNowParams.itemCount = that.measurementJson.minSaleCount;
    //       that.setData({
    //         byNowParams: that.byNowParams
    //       });
    //       that.setData({
    //         minCount: that.byNowParams.itemCount
    //       });
    //     },
    //     fail: function (res) {
    //       console.log("fail");
    //       getApp().globalData.loadFail();
    //     },
    //     complete: function () {}
    //   });
    // },

    /* 初始化 选规格 */
    // chooseMeasureItem: function (event) {
    //   console.log('----------初始化规格参数-----------', event);
    //   let productData = this.productData;
    //   let focusProduct = productData;
    //   let selectTypeData = [];

    //   for (let i = 0; i < focusProduct.measures.length; i++) {
    //     focusProduct.measures[i].checkedMeasureItem = 0; //初始化选择的数据

    //     let param = {};
    //     let selectTypeDataItem = {};
    //     param.name = focusProduct.measures[i].name;
    //     param.value = focusProduct.measures[i].productAssignMeasure[0].id;
    //     selectTypeDataItem.type = focusProduct.measures[i].name;
    //     selectTypeDataItem.value = focusProduct.measures[i].productAssignMeasure[0].measureName;
    //     console.log('=====param=====', param);
    //     this.MeasureParams.push(param);
    //     selectTypeData.push(selectTypeDataItem);
    //   }

    //   this.selectTypeData = selectTypeData;
    //   console.log('====that.data.selectTypeData======', this.selectTypeData);
    //   this.setData({
    //     productData: focusProduct
    //   });
    //   console.log('===MeasureParams====', this.MeasureParams);
    //   this.get_measure_cartesionFun();
    // },
    // //选择规格小巷的---显示
    // radioChange: function (e) {
    //   let that = this;
    //   let flag = false;
    //   console.log("====radioChange=====", e);
    //   console.log('====that.data.selectTypeData======', that.selectTypeData);

    //   if (that.selectTypeData) {
    //     console.log('1111111');

    //     for (let i = 0; i < that.selectTypeData.length; i++) {
    //       if (e.currentTarget.dataset.type == that.selectTypeData[i].type) {
    //         that.selectTypeData.splice(i, 1, e.currentTarget.dataset);
    //         flag = true;
    //       }
    //     }

    //     if (!flag) {
    //       that.selectTypeData.splice(that.selectTypeData.length, 1, e.currentTarget.dataset);
    //       flag = false;
    //     }
    //   } else {
    //     console.log('222222');
    //     that.selectTypeData = [];
    //     that.selectTypeData.splice(0, 1, e.currentTarget.dataset);
    //     that.setData({
    //       selectTypeData: that.selectTypeData
    //     });
    //   }

    //   console.log('====that.data.selectTypeData======', that.selectTypeData);
    //   let index = e.currentTarget.dataset.index;
    //   let indexJson = getApp().globalData.getSpaceStr(index, '-'); //console.log(indexJson)

    //   let focusItem = that.productData;
    //   focusItem.measures[indexJson.str1].checkedMeasureItem = indexJson.str2;
    //   that.setData({
    //     productData: focusItem
    //   });
    // },
    // //选择规格小巷---获取数据
    // chooseMeasure: function (e) {
    //   console.log(e.detail.value);
    //   let chooseMeasureJson = getApp().globalData.getSpaceStr(e.detail.value, '-');
    //   console.log(chooseMeasureJson);

    //   for (let i = 0; i < this.MeasureParams.length; i++) {
    //     if (this.MeasureParams[i].name == chooseMeasureJson.str1) {
    //       this.MeasureParams[i].value = chooseMeasureJson.str2;
    //     }
    //   }

    //   this.get_measure_cartesionFun();
    // },
    closeGuigeZhezhao: function () {
      this.setData({
        showGuigeType: false
      });
      this.MeasureParams = [];
    },
    // 获取二维码
    getQrCode: function () {
      let userId = "";

      if (getApp().globalData.loginUser && getApp().globalData.loginUser.platformUser) {
        userId = 'MINI_PLATFORM_USER_ID_' + getApp().globalData.loginUser.platformUser.id;
      } // console.log("app.loginUser.platformUser", app.loginUser.platformUser.id)
      // path=pageTab%2findex%2findex%3fAPPLY_SERVER_CHANNEL_CODE%3d'
      let postParam = {};
      postParam.SHARE_PRODUCT_DETAIL_PAGE = this.proId;
      postParam.scene = userId; // 上面是需要的参数下面的url

      console.log('====pp======', "/super_shop_manager_get_mini_code.html?mini=1&path=pageTab%2findex%2findex%3fSHARE_PRODUCT_DETAIL_PAGE%3d" + this.proId + "%26scene%3d" + userId);
      var customIndex = getApp().globalData.AddClientUrl("/super_shop_manager_get_mini_code.html?mini=1&path=pageTab%2findex%2findex%3fSHARE_PRODUCT_DETAIL_PAGE%3d" + this.proId + "%26scene%3d" + userId, postParam, 'get', '1');
      var result = customIndex.url.split("?");
      customIndex.url = result[0] + "?" + result[1];
      console.log("customIndex", customIndex.url, result[0]);
      var that = this;
      that.setData({
        qrCodeUrl: customIndex.url
      });
    },
    // 定位
    clickCatch: function (e) {
      console.log(this.productData.productInfo);
      let latitude = this.productData.productInfo.latitude;
      let longitude = this.productData.productInfo.longitude;
      let name = this.productData.productInfo.name;
      let address = this.productData.productInfo.location;
      wx.openLocation({
        latitude: latitude,
        longitude: longitude,
        scale: 12,
        name: name,
        address: address
      });
    },
    setData: function (obj) {
      let that = this;
      let keys = [];
      let val, data;
      Object.keys(obj).forEach(function (key) {
        keys = key.split('.');
        val = obj[key];
        data = that.$data;
        keys.forEach(function (key2, index) {
          if (index + 1 == keys.length) {
            that.$set(data, key2, val);
          } else {
            if (!data[key2]) {
              that.$set(data, key2, {});
            }
          }

          data = data[key2];
        });
      });
    }
  }
};
</script>
<style>
@import "./index.css";
</style>